<script setup lang="ts">

import {ref} from "vue";
import {CustomerService} from "@/http/Personal center";
import {useCounterStore} from "@/stores/SaveUser";


const show = ref(false);
const disappear=useCounterStore()
const actions = ref([
    { name:'' },
]);

CustomerService().then(res=>{
    // console.log(res)
    if (res.code===200){
        // console.log(res.data[0].dictValue)
        actions.value[0].name=res.data[0].dictValue
    }
})
const flag=ref(false)
console.log(disappear.red)
if (disappear.red==0){
    flag.value=false
}else{
    flag.value=true
}

function oncall(item){
    // console.log(item.name)
    window.location.href = "tel://" + item.name;
}

</script>

<template>
<div>
    <div class="red">
        <van-cell icon="comment-o" title="我的信息" is-link to="/wodexinxi"/>
        <van-badge dot class="one" v-if="flag">
            <div class="child" />
        </van-badge>
    </div>
    <van-cell icon="star-o" title="我的收藏" is-link to="wodeshoucang"/>
    <van-cell icon="service-o"  title="我的客服"  is-link @click="show = true" >
    </van-cell>
    <van-action-sheet
        @select="oncall"
        v-model:show="show"
        :actions="actions"
        cancel-text="取消"
        close-on-click-action
    />
    <van-cell icon="setting-o" title="设置" is-link to="shezhi"/>
</div>
</template>

<style scoped lang="less">
.red{
    position: relative;
    .one{
        position: absolute;
        right: 40px;
        top: 22px;
    }
}
:deep(.van-cell){
    margin-top: 10px;
}
:deep(.van-cell):hover{
    cursor: pointer;
}
</style>